<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;"/>
        <meta charset="utf-8"/>
        <!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
        <link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="dynsections.js"></script>
        <link rel="stylesheet" type="text/css" href="search/search.css" />
        <link rel="stylesheet" type="text/css" href="searchOverrides.css" />
        <script type="text/javascript" src="search/searchdata.js"></script>
        <script type="text/javascript" src="search/search.js"></script>
        <script type="text/javascript">
        /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
          $(document).ready(function() { init_search(); });
        /* @license-end */
        </script>
    </head>
    <body>
        <div id="banner-container">
            <div id="banner">
                <span id="sfml">SFML 2.6.1</span>
            </div>
        </div>
        <div id="content">
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <span id="MSearchSelect"                onmouseover="return searchBox.OnSearchSelectShow()"                onmouseout="return searchBox.OnSearchSelectHide()">&#160;</span>
          <input type="text" id="MSearchField" value="" placeholder="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1Touch.html">Touch</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classsf_1_1Touch-members.html">List of all members</a>  </div>
  <div class="headertitle"><div class="title">sf::Touch Class Reference<div class="ingroups"><a class="el" href="group__window.html">Window module</a></div></div></div>
</div><!--header-->
<div class="contents">

<p>Give access to the real-time state of the touches.  
 <a href="classsf_1_1Touch.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="Touch_8hpp_source.html">SFML/Window/Touch.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a2f85297123ea4e401d02c346e50d48a3"><td class="memItemLeft" align="right" valign="top">static bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Touch.html#a2f85297123ea4e401d02c346e50d48a3">isDown</a> (unsigned int finger)</td></tr>
<tr class="memdesc:a2f85297123ea4e401d02c346e50d48a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if a touch event is currently down.  <br /></td></tr>
<tr class="separator:a2f85297123ea4e401d02c346e50d48a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af1b7035be709091c7475075e43e2bc23"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classsf_1_1Vector2.html">Vector2i</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Touch.html#af1b7035be709091c7475075e43e2bc23">getPosition</a> (unsigned int finger)</td></tr>
<tr class="memdesc:af1b7035be709091c7475075e43e2bc23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current position of a touch in desktop coordinates.  <br /></td></tr>
<tr class="separator:af1b7035be709091c7475075e43e2bc23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8a1456574d2825d4249fcf72f11d4398"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classsf_1_1Vector2.html">Vector2i</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Touch.html#a8a1456574d2825d4249fcf72f11d4398">getPosition</a> (unsigned int finger, const <a class="el" href="classsf_1_1WindowBase.html">WindowBase</a> &amp;relativeTo)</td></tr>
<tr class="memdesc:a8a1456574d2825d4249fcf72f11d4398"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the current position of a touch in window coordinates.  <br /></td></tr>
<tr class="separator:a8a1456574d2825d4249fcf72f11d4398"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Give access to the real-time state of the touches. </p>
<p><a class="el" href="classsf_1_1Touch.html" title="Give access to the real-time state of the touches.">sf::Touch</a> provides an interface to the state of the touches.</p>
<p>It only contains static functions, so it's not meant to be instantiated.</p>
<p>This class allows users to query the touches state at any time and directly, without having to deal with a window and its events. Compared to the TouchBegan, TouchMoved and TouchEnded events, <a class="el" href="classsf_1_1Touch.html" title="Give access to the real-time state of the touches.">sf::Touch</a> can retrieve the state of the touches at any time (you don't need to store and update a boolean on your side in order to know if a touch is down), and you always get the real state of the touches, even if they happen when your window is out of focus and no event is triggered.</p>
<p>The getPosition function can be used to retrieve the current position of a touch. There are two versions: one that operates in global coordinates (relative to the desktop) and one that operates in window coordinates (relative to a specific window).</p>
<p>Touches are identified by an index (the "finger"), so that in multi-touch events, individual touches can be tracked correctly. As long as a finger touches the screen, it will keep the same index even if other fingers start or stop touching the screen in the meantime. As a consequence, active touch indices may not always be sequential (i.e. touch number 0 may be released while touch number 1 is still down).</p>
<p>Usage example: </p><div class="fragment"><div class="line"><span class="keywordflow">if</span> (<a class="code hl_function" href="classsf_1_1Touch.html#a2f85297123ea4e401d02c346e50d48a3">sf::Touch::isDown</a>(0))</div>
<div class="line">{</div>
<div class="line">    <span class="comment">// touch 0 is down</span></div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get global position of touch 1</span></div>
<div class="line"><a class="code hl_class" href="classsf_1_1Vector2.html">sf::Vector2i</a> globalPos = <a class="code hl_function" href="classsf_1_1Touch.html#af1b7035be709091c7475075e43e2bc23">sf::Touch::getPosition</a>(1);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get position of touch 1 relative to a window</span></div>
<div class="line"><a class="code hl_class" href="classsf_1_1Vector2.html">sf::Vector2i</a> relativePos = <a class="code hl_function" href="classsf_1_1Touch.html#af1b7035be709091c7475075e43e2bc23">sf::Touch::getPosition</a>(1, window);</div>
<div class="ttc" id="aclasssf_1_1Touch_html_a2f85297123ea4e401d02c346e50d48a3"><div class="ttname"><a href="classsf_1_1Touch.html#a2f85297123ea4e401d02c346e50d48a3">sf::Touch::isDown</a></div><div class="ttdeci">static bool isDown(unsigned int finger)</div><div class="ttdoc">Check if a touch event is currently down.</div></div>
<div class="ttc" id="aclasssf_1_1Touch_html_af1b7035be709091c7475075e43e2bc23"><div class="ttname"><a href="classsf_1_1Touch.html#af1b7035be709091c7475075e43e2bc23">sf::Touch::getPosition</a></div><div class="ttdeci">static Vector2i getPosition(unsigned int finger)</div><div class="ttdoc">Get the current position of a touch in desktop coordinates.</div></div>
<div class="ttc" id="aclasssf_1_1Vector2_html"><div class="ttname"><a href="classsf_1_1Vector2.html">sf::Vector2</a></div><div class="ttdoc">Utility template class for manipulating 2-dimensional vectors.</div><div class="ttdef"><b>Definition</b> <a href="Vector2_8hpp_source.html#l00037">Vector2.hpp:38</a></div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd><a class="el" href="classsf_1_1Joystick.html" title="Give access to the real-time state of the joysticks.">sf::Joystick</a>, <a class="el" href="classsf_1_1Keyboard.html" title="Give access to the real-time state of the keyboard.">sf::Keyboard</a>, <a class="el" href="classsf_1_1Mouse.html" title="Give access to the real-time state of the mouse.">sf::Mouse</a> </dd></dl>

<p class="definition">Definition at line <a class="el" href="Touch_8hpp_source.html#l00043">43</a> of file <a class="el" href="Touch_8hpp_source.html">Touch.hpp</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="af1b7035be709091c7475075e43e2bc23" name="af1b7035be709091c7475075e43e2bc23"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af1b7035be709091c7475075e43e2bc23">&#9670;&#160;</a></span>getPosition() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classsf_1_1Vector2.html">Vector2i</a> sf::Touch::getPosition </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>finger</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the current position of a touch in desktop coordinates. </p>
<p>This function returns the current touch position in global (desktop) coordinates.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">finger</td><td>Finger index</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Current position of <em>finger</em>, or undefined if it's not down </dd></dl>

</div>
</div>
<a id="a8a1456574d2825d4249fcf72f11d4398" name="a8a1456574d2825d4249fcf72f11d4398"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8a1456574d2825d4249fcf72f11d4398">&#9670;&#160;</a></span>getPosition() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classsf_1_1Vector2.html">Vector2i</a> sf::Touch::getPosition </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>finger</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classsf_1_1WindowBase.html">WindowBase</a> &amp;&#160;</td>
          <td class="paramname"><em>relativeTo</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the current position of a touch in window coordinates. </p>
<p>This function returns the current touch position relative to the given window.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">finger</td><td>Finger index </td></tr>
    <tr><td class="paramname">relativeTo</td><td>Reference window</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Current position of <em>finger</em>, or undefined if it's not down </dd></dl>

</div>
</div>
<a id="a2f85297123ea4e401d02c346e50d48a3" name="a2f85297123ea4e401d02c346e50d48a3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f85297123ea4e401d02c346e50d48a3">&#9670;&#160;</a></span>isDown()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static bool sf::Touch::isDown </td>
          <td>(</td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>finger</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Check if a touch event is currently down. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">finger</td><td>Finger index</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if <em>finger</em> is currently touching the screen, false otherwise </dd></dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Touch_8hpp_source.html">Touch.hpp</a></li>
</ul>
</div><!-- contents -->
        </div>
        <div id="footer-container">
            <div id="footer">
                SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
                Copyright &copy; Laurent Gomila &nbsp;::&nbsp;
                Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp;
            </div>
        </div>
    </body>
</html>
